﻿using AnesSystem.Controls;
using AnesSystem.Models;
using AnesSystem.Services;
using MongoDB.Bson;
using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Threading.Tasks;
using System.Windows;
using System.Xml;

namespace AnesSystem.ViewModels
{
    public class SysMainWinViewModel : MainPageCommonViewModel
    {
        #region Variables
       
        #endregion

        #region Constructor

        public SysMainWinViewModel()
        {
        }


        #endregion

        #region Properties

        #endregion

        #region Event

        #endregion

        #region Private Methods


        #endregion

        #region Public/Protected Methods

        public override void ReMsg()
        {
            Task.Factory.StartNew(delegate
            {
                Udp.UDPHelper.Instance.ReceiveMsg();
            });
        }

        public override void NavigateTo(string pageName, bool isMenuClick = true)
        {
            MenuListModel model = DataManager.Instance.MenuList.First(O => O.ClassName.Contains(pageName));
            if (!isMenuClick)
            {
                int id = DataManager.Instance.MenuList.First(O => O.Index == model.Parent).Parent;
                TopMenuCtrlViewModel.Instance.SetSelectMenu(id);
                LeftMenuCtrlViewModel.Instance.DispalyLeftMenu(id, model.ClassName);
            }
            DataManager.Instance.RightContentCtrlViewModel.CurrentRightContent = DataManager.Instance.GetFrameworkElement(model.ClassName);
        }

        #endregion

        #region EventHandlers

        #endregion
    }
}
